﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace caufingHealth
{
    public class PatientInformation
    {
          PatientInformation() { }

        /// <summary>
        /// Patient Record information
        /// </summary>
        public class PatientRecord
        {
            public int PatientID { get;   set; }
            public PatientName Name { get;   set; }
            public PatientAddress Address { get;   set; }
            public PatientDateOfBirth DateOfBirth {get;   set;}
            public PatientContactNumber ContactNumber { get;   set; }
            public List<PatientVisitRecord> Records { get;   set; }

            public PatientRecord()
            {
                
            }
            public void SetName(int _id, string _first, string _last)
            {
                Name = new PatientName();
                Name.SetName(_first, _last);
                PatientID = _id;
            }

            public void SetName(int _id, string _first, string _middle, string _last)
            {
                Name = new PatientName();
                Name.SetName(_first, _middle, _last);
                PatientID = _id;
            }

            public void SetAddress(int _streetNumber, string _streetName, string _city, string _state, int _zipCode)
            {
                Address = new PatientAddress();
                Address.SetPatientAddress(_streetNumber, _streetName, _city, _state, _zipCode);
            }

            public void SetDateOfBirth(int _month, int _day, int _year)
            {
                DateOfBirth = new PatientDateOfBirth();
                DateOfBirth.SetPatientDateOfBirth(_month, _day, _year);
            }

            public void SetContactNumber(int _area, int _local, int _residential)
            {
                ContactNumber = new PatientContactNumber();
                ContactNumber.SetPatientContactNumber(_area, _local, _residential);
            }

            public void SetContactNumber(string number)
            {
                SetContactNumber(int.Parse(number.Substring(0, 3)),
                              int.Parse(number.Substring(3, 3)),
                              int.Parse(number.Substring(6)));
            }

            public void AddRecord(DateTime visitDate, string symptoms, string temperature, string pulse, string bp1, string bp2, string diagnosis)
            {
                if(Records == null)
                    Records = new List<PatientVisitRecord>();
                PatientVisitRecord record = new PatientVisitRecord();
                record.SetPatientVisitRecord(visitDate, symptoms, temperature, pulse, bp1, bp2, diagnosis);
                Records.Add(record);
            }

            /// <summary>
            /// The patients Name
            /// </summary>
            public class PatientName
            {
                public string FirstName { get;   set; }
                public string MI { get;   set; }
                public string LastName{get;   set;}

                public void SetName(string first, string middle, string last)
                {
                    FirstName = first;
                    MI = middle;
                    LastName = last;
                }
                public void SetName(string first, string last)
                {
                    FirstName = first;
                    LastName = last;
                    
                }
            }

            /// <summary>
            /// Street Address and city/state/zipcode of the patient.
            /// </summary>
            public class PatientAddress
            {
                public string Address { get;   set; }
                public string City { get;   set; }
                public string State { get;   set; }
                public string ZipCode { get;   set; }

                public void SetPatientAddress(int streetNumber, string streetName, string city, string state, int zipCode)
                {
                    Address = string.Format("{0} {1}", streetNumber, streetName);
                    City = city;
                    State = state;
                    ZipCode = zipCode.ToString();
                }
            }

            /// <summary>
            /// Patient's Date of Birth
            /// </summary>
            public class PatientDateOfBirth
            {
                public string Month { get;   set; }
                public string Day { get;   set; }
                public string Year { get;   set; }
                public long DOBLong { get; set; }
                public void SetPatientDateOfBirth(int month, int day, int year)
                {
                    Month = month.ToString();
                    Day = day.ToString();
                    Year = year.ToString();
                //    DOBLong = dobLong;
                }
            }

            /// <summary>
            /// Patients contact number
            /// </summary>
            public class PatientContactNumber
            {
                public string AreaCode { get;   set; }
                public string LocalCode { get;   set; }
                public string ResidentialCode { get;   set; }

                public void SetPatientContactNumber(int area, int local, int residential)
                {
                    AreaCode = area.ToString();
                    LocalCode = local.ToString();
                    ResidentialCode = residential.ToString();
                }
            }

            public class PatientVisitRecord
            {
                public DateTime VisitDate { get;   set; }
                public long VisitDateLong { get; set; }
                public string Symptoms { get;   set; }
                public string Temperature { get;   set; }
                public string Pulse { get;   set; }
                public string BloodPressure1 { get;   set; }
                public string BloodPressure2 { get;   set; }
                public string Diagnosis { get; set; }
                public int DoctorID { get; set; }
                public void SetPatientVisitRecord(DateTime visitDate, string symptoms, string temperature, string pulse, string bp1, string bp2, string diagnosis)
                {
                    
                    VisitDate = visitDate;
                    Symptoms = symptoms;
                    Temperature = temperature;
                    Pulse = pulse;
                    BloodPressure1 = bp1;
                    BloodPressure2 = bp2;
                    Diagnosis = diagnosis;
                }
            }

            public class PatientLabRecord
            {
                public DateTime VisitDate { get; set; }
                public long VisitDateLong { get; set; }
                public string Type { get; set; }
                public String Result { get; set; }
                public int DoctorID { get; set; }
                public void SetPatientLabRecord(DateTime visitDate, string type, String result, long visitDateLong)
                {
                    this.VisitDate = visitDate;
                    this.Type = type;
                    this.Result = result;
                    this.VisitDateLong = visitDateLong;
                }
            }
        }
    }
}
